<!DOCTYPE html>
<html>

<head>
  <meta content="telephone=no" name="format-detection">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Language" content="zh-CN">
  <meta http-equiv="x-ua-compatible" content="IE=edge, chrome=1">
  <meta name="viewport"
    content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <meta name="renderer" content="webkit">
  <meta name="keywords" content="关键词" />
  <meta name="description" content="页面简介" />
  <link rel="icon" href="favicon.ico" />
  <link rel="shortcut icon" href="favicon.ico" />
  <link href="csaa/css/style.css" rel="stylesheet" type="text/css" />
  <link rel="stylesheet" href="./csaa/fonts/iconfont/iconfont.css">
  <link rel="stylesheet" href="./csaa/fonts/materialicons/material-icons.css">

  <script language="javascript" type="text/javascript" src="csaa/js/jquery.min.js"></script>
  <script language="javascript" type="text/javascript" src="csaa/js/site.js"></script>
  <script src="csaa/js/httpPath.js"></script>
  <script src="csaa/js/httpUtils.js"></script>
  <title>全国青少年航空科学素质等级考试</title>
</head>

<body>
  <!-- 头部 开始 -->
  <div class="header">

  </div>
  <!-- 头部 结束 -->


  <!-- 内页banner 开始 -->
  <div class="in_banner">
    <div class="in_banner_box" style="background-image: url(./demo/img/banner01.jpg)
	"></div>
    <div class="text">全国考务中心</div>
  </div>
  <!-- 内页banner 开始 -->

  <!-- 主体 开始 -->
  <div id="ex_main">
    <div class="main">
      <div class="ex_content">
        <div class="ex_filter">
          <div class="filterstore_form">
            <div>
              <span class="label">查找考务中心</span>
              <select class="form_input form_select rowwidth_10" placeholder="省份" name="province" id="province">
                <option>省份</option>
              </select>
              <select class="form_input form_select rowwidth_10" placeholder="地级市" name="city" id="city">
                <option>地级市</option>
              </select>
              <select class="form_input form_select rowwidth_20" placeholder="市、县级市、县" name="area" id="area">
                <option>市、县级市、县</option>
              </select>
              <input type="text" class="form_input form_select rowwidth_30" placeholder="请输入详细地址" name="detail_area"
                id="search_input">

              <input type="button" class="btn_search btn btn_color_1 btn_shadow" value="搜索">
            </div>
          </div>
        </div>
        <div class="list_ex">
          <div class="nothing tips">请输入关键词或选择地址查询考务中心</div>
        </div>

      </div>
      <div class="latest_news">
        <div class="kaowu_center_wrap">
          <a class="btn_kaowu" href="./examination_center.html">
            <i class="material-icons">&#xe8d1;</i>
            <span>全国考务中心</span>
          </a>
        </div>
        <div class="latest_title"><i class="material-icons">&#xe05e;</i><span class="text">最新动态</span></div>
        <div class="list_latest">

        </div>
        <div class="manage_btnwrap">
          <a class="btn btn_color_1" href="./news.html">查看更多</a>
        </div>
      </div>


      <!-- 考务中心模板 开始 -->
      <div id="tmp_item_ex" style="display: none;">
        <div class="item">
          <div class="item_i num">1</div>
          <div class="item_i name">--</div>
          <div class="item_i chargename">
            <div class="label">联系人:</div>
            <div class="text">--</div>
          </div>
          <div class="item_i phone">
            <div class="label">电话:</div>
            <div class="text">--</div>
          </div>
          <div class="item_i address">
            <div class="label">地址:</div>
            <div class="text">--</div>
          </div>
          <div class="manage_btnwrap">
            <a href="./" class="btn btn_color_1">查看教师</a>
          </div>
        </div>
      </div>
      <!-- 考务中心模板 结束 -->

      <!-- 动态模板 开始 -->
      <div id="tmp_item_news" style="display: none;">
        <div class="item">
          <div class="item_box">
            <a class="img_wrap">
              <div class="img" style="background-image: url()"></div>
            </a>
            <a class="text_wrap">
              <div class="title">
                <span class="title_text"></span>
              </div>
              <div class="subtitle"></div>
              <div class="time"></div>
            </a>
          </div>
        </div>
      </div>
      <!-- 动态模板 结束 -->

    </div>
    <!-- footer 开始-->
    <div class="footer_wrap">
    </div>
    <script>
      fun_islogin(true); //页面头部登录

      //载入省级
      var params = {
        "level": 1,
        "parentId": 0
      };
      $.ajax({
        url: GET_AREA,
        data: params,
        type: "GET",
        dataType: "JSON",
        success: function (data, textStatus) {
          if (typeof data != "object") {
            data = JSON.parse(data);
          }

          if (data.status == 1) {
            var fetch_data = data.data;
            var tmp_option = "";
            $.each(fetch_data, function (data_i, data_n) {
              tmp_option += '<option value="' + data_n.code + '">' + data_n.name + '</option>'
            });
            $('#province').append(tmp_option);
            $("#area").prepend($("<option selected=\"selected\"></option>").text("市、县级市、县"));
          } else {
            $.fn.poptips(data.msg);
          }
        },
        error: function (xhr, textStatus, errorThrown) {
          $.fn.poptips("连接超时，请检查您的网络");
        }
      });

      //选择省 载入市
      $(document).on("change", "#province", function () {
        $('#city').empty();
        $('#area').empty();
        var params = {
          "level": 2,
          "parentId": $(this).val(),
          "code": $(this).val()
        };
        $.ajax({
          url: GET_AREA,
          data: params,
          type: "GET",
          dataType: "JSON",
          success: function (data, textStatus) {
            if (typeof data != "object") {
              data = JSON.parse(data);
            }

            if (data.status == 1) {
              var fetch_data = data.data;
              var tmp_option = "";
              $.each(fetch_data, function (data_i, data_n) {
                tmp_option += '<option value="' + data_n.code + '">' + data_n.name + '</option>'
              });
              $('#city').append(tmp_option);
              $("#city").prepend($("<option selected=\"selected\"></option>").text("地级市"));
              $("#area").prepend($("<option selected=\"selected\"></option>").text("市、县级市、县"));
            } else {
              $.fn.poptips(data.msg);
            }
          },
          error: function (xhr, textStatus, errorThrown) {
            $.fn.poptips("连接超时，请检查您的网络");
          }
        });
      });

      //选择市 载入区县
      $(document).on("change", "#city", function () {
        $('#area').empty();
        var params = {
          "level": 3,
          "parentId": $(this).val(),
          "code": $(this).val()
        };
        $.ajax({
          url: GET_AREA,
          data: params,
          type: "GET",
          dataType: "JSON",
          success: function (data, textStatus) {
            if (typeof data != "object") {
              data = JSON.parse(data);
            }

            if (data.status == 1) {
              var fetch_data = data.data;
              var tmp_option = "";
              $.each(fetch_data, function (data_i, data_n) {
                tmp_option += '<option value="' + data_n.code + '">' + data_n.name + '</option>'
              });
              $('#area').append(tmp_option);
              $("#area").prepend($("<option selected=\"selected\"></option").text("市、县级市、县"));
            } else {
              $.fn.poptips(data.msg);
            }
          },
          error: function (xhr, textStatus, errorThrown) {
            $.fn.poptips("连接超时，请检查您的网络");
          }
        });
      });

      //本页搜索
      $(document).on("click", ".filterstore_form .btn_search", function (e) {
        //e.preventDefault();
        //$("#ex_main .main_more").data("page", 1).click();
        // if ($("#province").val() == "省份") {
        //     $.fn.winktips("请先选择省份");
        //     return false;
        // };

        $(".list_ex .item").remove();
        fun_getlist();
      });

      function fun_getlist() {

        var tmp_province = ($("#province").val() != "省份") ? $("#province").val() : "";
        var tmp_city = ($("#city").val() != "地级市") ? $("#city").val() : "";
        var tmp_area = ($("#area").val() != "市、县级市、县") ? $("#area").val() : "";
        var tmp_search = $("#search_input").val();

        var tmp_parms = {
          pageSize: 1000,
          pageNum: 1,
          provNo: tmp_province,
          cityNo: tmp_city,
          areaNo: tmp_area,
          name: tmp_search
        };

        $.ajax({
          type: "POST",
          url: GET_CenterList,
          data: tmp_parms,
          timeout: 20000,
          success: function (data, textStatus) {
            if (data.status == 1) {
              $(".list_ex .nothing").remove();
              var $tmp_html = $("<div/>");
              var fetch_data = data.data.centerlist;

              if (fetch_data.length == 0) {
                $(".list_ex").html("<div class=\"nothing\">对不起，没找到你想要的考务中心</div>");
                return false;
              } else {
                $(".list_ex .tips").remove();
                for (var i = 0; i < fetch_data.length; i++) {
                  var $tmp_item = $("#tmp_item_ex .item").clone();

                  $tmp_item.find(".num").text(i + 1);
                  $tmp_item.find(".name").text(fetch_data[i].centerName);
                  $tmp_item.find(".address .text").text(fetch_data[i].prov + fetch_data[i].city + fetch_data[i].area);
                  $tmp_item.find(".chargename .text").text(fetch_data[i].chargeName);
                  $tmp_item.find(".phone .text").text(fetch_data[i].chargePhone);

                  $tmp_item.attr("data-id", fetch_data[i].centerId);
                  $tmp_item.find(".manage_btnwrap .btn").attr("href", "./examination_teacherlist.html?id=" + fetch_data[i].centerId + "&name=" + fetch_data[i].centerName);

                  $tmp_html.append($tmp_item);
                };
                $tmp_html.find(".item").appendTo(".list_ex");
              }
            } else {
              $.fn.winktips(data.msg);
              $(".list_ex").html("<div class=\"nothing\">对不起，没找到你想要的考务中心</div>");
            };
          },
          error: function (XMLHttpRequest, textStatus, errorThrown) {
            $.fn.winktips("连接超时，请检查您的网络");
          }
        });

      };

      // 载入最新动态
      fun_news();
    </script>


    <!------------------------------------ 主体分割 -------------------------------->



  </div>
  <!-- 主体 结束 -->


</body>

</html>
